package team.cw.land.test.activiti.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import team.cw.land.test.activiti.service.IActivitiService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping
public class LoginController {


    @GetMapping("")
    public String index(HttpServletRequest request){
        return "login";
    }

    @PostMapping("/login")
    public String login(HttpServletRequest request, String userName){
        request.setAttribute("userName",userName);
        HttpSession session = request.getSession();
        session.setAttribute("userName",userName);
        return "index";
    }

}
